package com.yxh.www.author.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统菜单-RBAC
 * </p>
 *
 * @author Yangxiaohui
 * @since 2020-05-09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SmResource extends Model<SmResource> {

    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    /**
     * 资源标题
     */
    @TableField("resource_title")
    private String resourceTitle;

    /**
     * 资源图标
     */
    @TableField("resource_icon")
    private String resourceIcon;

    /**
     * 资源路径
     */
    @TableField("resource_path")
    private String resourcePath;

    /**
     * 父级ID
     */
    @TableField("parent_id")
    private String parentId;

    /**
     * 权限标识
     */
    @TableField("permission_key")
    private String permissionKey;

    /**
     * 资源（0：目录；1：菜单；2：按钮）
     */
    @TableField("resource_type")
    private String resourceType;

    /**
     * 资源状态
     */
    @TableField("resource_status")
    private String resourceStatus;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 排序编号
     */
    @TableField("order_number")
    private Integer orderNumber;

    public SmResource(String resourceTitle, String resourceIcon, String resourcePath, String parentId, String permissionKey, String resourceType) {
        this.resourceTitle = resourceTitle;
        this.resourceIcon = resourceIcon;
        this.resourcePath = resourcePath;
        this.parentId = parentId;
        this.permissionKey = permissionKey;
        this.resourceType = resourceType;
    }

    public SmResource(String id, String resourceTitle, String resourceIcon, String resourcePath, String permissionKey, String resourceStatus, Integer orderNumber) {
        this.id = id;
        this.resourceTitle = resourceTitle;
        this.resourceIcon = resourceIcon;
        this.resourcePath = resourcePath;
        this.permissionKey = permissionKey;
        this.resourceStatus = resourceStatus;
        this.orderNumber = orderNumber;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
